// Copyright (c) Duende Software. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using System.Diagnostics;

namespace Duende.IdentityModel.OidcClient.Infrastructure;

internal static class StringExtensions
{
    [DebuggerStepThrough]
    public static string EnsureTrailingSlash(this string input)
    {
        if (!input.EndsWith("/"))
        {
            return input + "/";
        }

        return input;
    }

    [DebuggerStepThrough]
    public static bool IsMissing(this string value) => string.IsNullOrWhiteSpace(value);

    [DebuggerStepThrough]
    public static bool IsPresent(this string value) => !string.IsNullOrWhiteSpace(value);
}
